
.plantuml-editor {
  max-width: 100%;
  margin: 0 auto;
  padding: 15px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.toolbar-card {
  margin-bottom: 15px;
  flex-shrink: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  h3 {
  margin: 0;
  color: #333;
}

  &-actions {
  display: flex;
  gap: 10px;
    align-items: center;
  }
}

.main-container {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 15px;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 120px);
  overflow: auto;
}

/* 元素库样式 */
.element-library {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.library-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;

  small {
  color: #666;
    font-size: 0.85em;
  }
}

.library-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.library-elements {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.library-element {
  cursor: grab;
  transition: all 0.2s;
  user-select: none;
  padding: 6px 8px;

  &:hover {
  transform: translateY(-1px);
}

  &:active {
  cursor: grabbing;
}

  .element-icon {
    width: 26px;
    height: 26px;
  border-radius: 50%;
    background: var(--el-color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
    margin-right: 8px;
    font-size: 12px;
}

  .element-label {
  font-weight: 500;
  color: #333;
    font-size: 12px;
  }
}

.relationship-element .element-icon {
  background: var(--el-color-success);
}

/* 画布样式 */
.canvas-container {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;

  :deep(.el-card__body) {
    flex: 1;
  }
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #e4e7ed;
  background: #fafafa;
  flex-shrink: 0;
}

.canvas-controls {
  display: flex;
  gap: 8px;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 400px;
  overflow: hidden;
  flex: 1;
}

.canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 400px;
  overflow: hidden;
  cursor: default;
  flex: 1;
  user-select: none;
  
  &.dragging {
    cursor: grabbing;
  }
  
  &.selecting {
    cursor: crosshair;
  }
  
  &.connecting {
    cursor: crosshair;
  }
}

.canvas-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  transition: transform 0.1s ease-out;
  padding: 20px;
}

/* 画布元素样式 */
.canvas-element {
  position: absolute;
  min-width: 150px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  cursor: move;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  user-select: none;

  &:hover {
    border-color: var(--el-color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
  }

  &.selected {
    border-color: var(--el-color-primary);
    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.25);
  }

  &.dragging {
  cursor: grabbing;
  z-index: 1000;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transform: scale(1.02);
    transition: none;
}

.element-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.element-type-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
    background: var(--el-color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  margin-right: 8px;
}

.element-name {
  flex: 1;
  font-weight: bold;
  color: #333;
}

.delete-btn {
  opacity: 0;
  transition: opacity 0.2s;
}

  &:hover .delete-btn {
  opacity: 1;
}

.element-content {
  font-size: 12px;
}

.attributes-section,
.methods-section {
  margin-bottom: 8px;
}

.attribute,
.method {
  margin-bottom: 2px;
  font-family: 'Courier New', monospace;
}

.visibility {
  font-weight: bold;
  margin-right: 4px;
  }
}

.drag-preview {
  position: absolute;
  background: rgba(64, 158, 255, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%);
}

/* 连接点样式 */
.connection-points {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.connection-point {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--el-color-primary);
  border-radius: 50%;
  cursor: crosshair;
  border: 2px solid white;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  pointer-events: all;
  transition: all 0.2s;
  opacity: 0.3;
  z-index: 10;

  &:hover {
    background: var(--el-color-primary-dark-2);
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(64, 158, 255, 0.5);
  opacity: 1;
}

  &.top {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);

    &:hover {
      transform: translateX(-50%) scale(1.2);
    }
}

  &.right {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);

    &:hover {
      transform: translateY(-50%) scale(1.2);
    }
}

  &.bottom {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);

    &:hover {
      transform: translateX(-50%) scale(1.2);
    }
}

  &.left {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);

    &:hover {
      transform: translateY(-50%) scale(1.2);
    }
  }
}

.canvas-element:hover .connection-point {
  opacity: 1;
  transform: scale(1.1);
}

/* 关系线删除按钮样式 */
.relationship-group {
  cursor: pointer;
}

.relationship-line {
  &.selected {
    stroke-width: 3;
    stroke: #007bff;
    filter: drop-shadow(0 2px 4px rgba(0, 123, 255, 0.3));
  }
}

.relationship-delete-btn {
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    fill: #c82333;
    transform: scale(1.1);
  }
}

.relationship-delete-text {
  cursor: pointer;
  pointer-events: all;
  user-select: none;
}

/* 右键菜单样式 */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 10px;
  z-index: 1000;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: #f5f7fa;
    transform: translateX(5px);
  }

  span {
    font-size: 14px;
  color: #333;
  }
}

/* 属性面板样式 */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.property-panel {
  height: fit-content;
  min-height: 180px;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 300px;
}

.preview-panel {
  height: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.preview-controls {
  display: flex;
  gap: 8px;
}

.preview-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  padding: 15px;
  min-height: 0;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: auto;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;

  .is-loading {
    animation: rotate 1s linear infinite;
  }

  p {
    margin: 0;
    color: #606266;
    font-size: 14px;
    font-weight: 500;
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: white;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 15px;
}

.uml-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  
  &:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }
}

.empty-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 50%;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .main-container {
    grid-template-columns: 200px 1fr 260px;
    gap: 12px;
  }
  
  .plantuml-editor {
    padding: 10px;
  }
}

@media (max-width: 1000px) {
  .main-container {
    grid-template-columns: 180px 1fr 240px;
    gap: 10px;
  }
  
  .toolbar-actions {
    gap: 8px;
  }
  
  .toolbar-actions .el-button {
    padding: 8px 12px;
    font-size: 12px;
  }
}

@media (max-width: 800px) {
  .main-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
  }
  
  .element-library {
    order: 1;
    max-height: 200px;
  }
  
  .canvas-container {
    order: 2;
  }
  
  .right-panel {
    order: 3;
    max-height: 300px;
  }
  
  .plantuml-editor {
    height: auto;
    min-height: 100vh;
  }
}

/* 模型选择对话框样式 */
.model-selection {
  padding: 20px 0;
}

.model-info {
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f7fa;
  border-radius: 8px;
  border-left: 4px solid var(--el-color-primary);

  p {
    margin: 0;
    color: #606266;
  }
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.model-item {
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  &.selected {
    border-color: var(--el-color-primary);
    background: #f0f9ff;
  }
}

.model-header h4 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 16px;
}

.model-description p {
  margin: 0;
  color: #666;
  font-size: 14px;
  line-height: 1.4;
}

.dialog-footer {
  text-align: right;
}

.model-info small {
  color: #909399;
  font-style: italic;
}

/* 空状态面板样式 */
.empty-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 20px;
}

.empty-description {
  text-align: center;
  color: #909399;
  
  p {
    margin: 8px 0;
  font-size: 14px;
  }
  
  .empty-tip {
    font-size: 12px;
    color: #c0c4cc;
    margin-top: 12px;
  }
}

/* 图片预览对话框样式 */
.image-preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  
  .preview-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  }
}

/* 响应式设计 */